<?php
namespace Amis\form;
class MatrixCheckboxes extends FormItem
{
    public string $type = 'matrix-checkboxes';

    /**
     * 列信息，数组中 label 字段是必须给出的
     * @param $columns
     * @return $this
     */
    public function columns($columns)
    {
        $this->columns = $columns;
        return $this;
    }

    /**
     * @param string $api
     * @return $this
     */
    public function source(string $api)
    {
        $this->source = $api;
        return $this;
    }

    public function rows(array $rows)
    {
        $this->rows = $rows;
        return $this;
    }

    /**
     * @param string $rowLabel
     * @return $this
     */
    public function rowLabel(string $rowLabel)
    {
        $this->rowLabel = $rowLabel;
        return $this;
    }

    public function multiple(bool $multiple = false)
    {
        $this->multiple = $multiple;
        return $this;
    }

    /**
     * 设置单选模式，multiple为false时有效，可设置为cell, row, column 分别为全部选项中只能单选某个单元格、每行只能单选某个单元格，每列只能单选某个单元格
     * @param string $singleSelectMode
     * @return $this
     */
    public function singleSelectMode(string $singleSelectMode = 'column')
    {
        $this->singleSelectMode = $singleSelectMode;
        return $this;
    }
}